<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<html lang="pl">  
    <head>
        <jsp:include page="./../util/configurationPage.jsp"/>
        <style type="text/css">
            #inner {
                display: table;
                margin: 0 auto;
            }

            #activeEx {
                background-color : #5CB85C;
                color:#ffffff;
                border: 1px;

            }
        </style>


        <script type="text/javascript">
            $(window).on('load', function() {

                $('.selectpicker').selectpicker();

                // $('.selectpicker').selectpicker('hide');
            });
        </script>
    </head>
    <body>
        <jsp:include page="./../navbar/navbarMain.jsp"/>
        <br>

        <div class="container ">
            <div class="col-lg-12">
                <div class="row">
                    <div class="col-lg-3">
                        <jsp:include page="./../navbar/menuBar.jsp"/>
                    </div>
                    <div class="col-lg-9">
                        <form:form method="POST" commandName="commandBean" action="details.htm?id=${commandBean.id}" >
                            <c:if test="${error eq 1}">
                                <div class="alert alert-danger"> <strong>Uwaga!</strong> Niewystarczjąca ilość dostepnego towaru </div>


                            </c:if>
                            <c:if test="${error eq 2}">

                                <div class="alert alert-danger"> <strong>Uwaga!</strong> Nieprawidłowy typ danych. Wymagana wartość liczbowa </div>

                            </c:if>

                       


                            <div class="panel panel-success">

                                <div class="panel-heading">
                                    <h3 class="panel-title">Szczegóły produktu</h3>
                                </div>
                                <div class="panel-body">

                                    <div class="media">

                                        <a class="pull-left" href="#">
                                            <img class="media-object" data-src="holder.js/64x64" alt="64x64" style="width: 320px; height: 320px; " src="data:image/jpeg;base64,${commandBean.file}">
                                        </a>
                                        <div class="media-body">
                                            <h4 class="media-heading">${commandBean.name}</h4>
                                            <h5 class="media-list"><b>Kategoria: </b>${commandBean.category}</h5>
                                            <h5 class="media-list"><b>Producent: </b>${commandBean.manufacturer}</h5>
                                            <h5 class="media-list"><b>Cena: </b>${commandBean.price} zł</h5>
                                            <h5 class="media-list"><b>Dostępnych sztuk: </b>${commandBean.amount}</h5>
                                        </div>
                                    </div>
                                    <br>
                                    ${commandBean.description}<br>
                                    <br>

                                    <c:if test="${commandBean.availableUser eq true}">

                                        <div class="pull-right">

                                            <div class="input-group">
                                                <span class="input-group-addon">Ilość</span>
                                                <form:input path="orderedQuantity" type="text" class="form-control" value="1"  maxlength="3" size="1" />

                                                <span class="input-group-btn">
                                                    <button class="btn btn-success" type="submit">Kup</button>
                                                </span>
                                            </div>

                                        </div>

                                    </c:if>

                                </div>
                            </div>
                        </form:form>
                    </div>
                </div>  
            </div>
        </div>


        <jsp:include page="./../util/footer.jsp"/>
    </body>
</html>

